﻿using Shop.RemoteModel.GoodsSku;
using Shop.RemoteModel.GoodsSku.Model;
using Shop.StoreGatewayModular.Interface;
using WeDonekRpc.Client;
using WeDonekRpc.HttpApiGateway.Model;

namespace Shop.StoreGatewayModular.Service
{
    internal class GoodsSkuService : IGoodsSkuService
    {
        public bool Set (long id, GoodsSkuSet set)
        {
            return new SetGoodsSku
            {
                Id = id,
                Datum = set
            }.Send();
        }
        public PagingResult<GoodsSkuDatum> Query (PagingParam<SkuQueryParam> obj)
        {
            return new QueryGoodsSku
            {
                Index = obj.Index,
                Size = obj.Size,
                SortName = obj.SortName,
                IsDesc = obj.IsDesc,
                NextId = obj.NextId,
                Query = obj.Query,
            }.Send();
        }
        public GoodsSkuDto Get (long goodsId, string specKey)
        {
            return new GetGoodsSku
            {
                GoodsId = goodsId,
                SpecKey = specKey
            }.Send();
        }

        public long Add (GoodsSkuAdd datum)
        {
            return new AddGoodsSku
            {
                Datum = datum
            }.Send();
        }

        public GoodsSkuDatum[] Gets (long[] ids)
        {
            return new GetsGoodsSku
            {
                SkuId = ids
            }.Send();
        }
    }
}
